<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="author" content="">
    <meta name="copyright" content="">
    <title>支付处理</title>
    #include("common.html")
    <script type="text/javascript" src="#(tpath)/static/js/jquery.js"></script>
    <script type="text/javascript" src="#(tpath)/static/js/jquery.qrcode.js"></script>
    <style>
        .pay {
            background-color: #333333;
        }
        
        .pay .thumbnail {
            width: 276px;
            margin: 200px auto;
            border-radius: 0px;
            border: none;
            background-color: transparent;
        }
        
        .pay .thumbnail h5 {
            margin-bottom: 20px;
            color: #ffffff;
        }
        
        .pay .thumbnail .qrcode {
            padding: 10px;
            margin-bottom: 20px;
            background-color: #ffffff;
        }
        
        .pay .thumbnail .caption p {
            padding: 15px 10px;
            color: #ffffff;
            font-size: 14px;
            border-radius: 100px;
            background-color: #232323;
        }
    </style>
    <script>
    $().ready(function() {
    
        var orderId = "#(orderId)";
        var $qrcode = $("#qrcode");
        
        // 二维码
        $qrcode.qrcode({
            width: 256,
            height: 256,
            text: "#(codeUrl)"
        });
        
        // 检查是否支付成功
        setInterval(function() {
            $.ajax({
                url: "#(base)/payment/checkPay",
                data: {
                	orderId: orderId
                },
                type: "GET",
                dataType: "json",
                cache: false,
                success: function(response) {
                    if (response.data.isPayed) {
                        location.href = "#(base)/payment/weixinpayReturn/#(orderSn)";
                    }
                }
            });
        }, 10000);
    
    });
    </script>
</head>
<body class="pay">
    <div class="thumbnail text-center">
        <h5 style="text-align: center;">微信扫码支付</h5>
        <div id="qrcode" class="qrcode"></div>
        <div class="caption" style="text-align: center;">
            <p>请使用微信扫描二维码完成支付</p>
        </div>
    </div>
</body>
</html>